package com.jzr.board.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jzr.board.R
import com.jzr.board.bean.EcgBean
import com.jzr.board.bean.FeeDataBean
import com.jzr.board.bean.OxyBean
import pers.noclay.ecgwaveview.ECGWaveView

class EcgAdapter(data: MutableList<OxyBean.Data>?) :
    BaseQuickAdapter<OxyBean.Data, BaseViewHolder>(
        R.layout.item_ecg,
        data
    ) {

    override fun convert(helper: BaseViewHolder?, item: OxyBean.Data?) {
        val wavesView = helper?.getView<ECGWaveView>(R.id.wavesView)
        helper?.setText(R.id.tvName, item?.name)
        helper?.setText(R.id.tvOxy, item?.oxySat)
        helper?.setText(R.id.tvPulse, item?.pulse)
        helper?.setText(R.id.tvCureNo, item?.admissionId)
        helper?.setText(R.id.tvBedNo, item?.bedNo)

        if (item?.oxySat != null) {
            wavesView?.drawNextPoint(item.oxySat!!.toFloat())
        }
    }

}